package com.gliese.bambook.util;

import java.util.HashSet;

import org.htmlparser.Node;
import org.htmlparser.NodeFilter;
import org.htmlparser.Remark;
import org.htmlparser.Tag;

public class SpecificTagNodesFilter implements NodeFilter {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8209872379389352723L;
	private HashSet<String> removeTagNames;

	public SpecificTagNodesFilter() {
		super();
		removeTagNames = new HashSet<String>();
		removeTagNames.add("BR");
		removeTagNames.add("META");
		removeTagNames.add("STYLE");
		removeTagNames.add("SCRIPT");
		removeTagNames.add("!DOCTYPE");
		removeTagNames.add("LINK");
	}

	@Override
	public boolean accept(Node node) {
		if (node instanceof Remark)
			return true;
		else if ((node instanceof Tag)
				&& removeTagNames.contains(((Tag) node).getTagName())) {
			return true;
		}
		else
			return false;
	}
}
